<template>
  <el-dialog v-model="state.dialogVisible" title="模具筛选" width="1000">
    <el-form :model="state.form">
      <el-row :gutter="12">
        <el-col :span="12">
          <el-form-item label="模具编码" prop="moldCode">
            <el-input
              v-model="state.form.moldCode"
              placeholder="请录入模具编码"
            />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="模具名称" prop="moldName">
            <el-input
              v-model="state.form.moldName"
              placeholder="请录入模具名称"
            />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="模具规格" prop="moldSpec">
            <el-input
              v-model="state.form.moldSpec"
              placeholder="请录入模具规格"
            />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="close">取消</el-button>
        <el-button type="primary" @click="confirm">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>
<script setup>
  import { localStorageConfig } from '@/config/localstorage.config'

  const pkCorp = localStorage.getItem(localStorageConfig.__pkCorp)

  const state = reactive({
    dialogVisible: false,
    form: { moldCode: '', moldName: '', moldSpec: '', pkCorp: pkCorp },
  })
  const close = () => {
    state.dialogVisible = false
  }
  const confirm = () => {
    _emits('searchCallback', state.form)
    close()
  }
  const handleOpen = () => {
    state.dialogVisible = true
  }
  defineExpose({
    handleOpen,
  })
  const _emits = defineEmits(['searchCallback'])
</script>
